home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: seebs@taniemarie.solon.com (Peter Seebach)
- Newsgroups: comp.std.c,comp.lang.c.moderated
- Subject: Re: printf() format extensions - looking for beta testers...
- Date: 12 Apr 1996 08:19:49 -0500
- Organization: Usenet Fact Police (Undercover)
- Sender: clc@solutions.solon.com
- Approved: clc@solutions.solon.com
- Message-ID: <4kll9l$o5h@solutions.solon.com>
- References: <4kgljv$l2p@solutions.solon.com> <4klicn$ndl@solutions.solon.com>
- NNTP-Posting-Host: solutions.solon.com
-
- In article <4klicn$ndl@solutions.solon.com>,
- Ari Lukumies <aril@cmt.lpr.mail.carel.fi> wrote:
- >Peter Seebach wrote:
- > > int bangcvt(va_list *ap, char *s, int len, fmtspec *f) {
- > > strncpy(s, strerror(errno), len);
- > > s[len - 1] = '\0';
- > > return strlen(s);
- > > }
-
- >Given the above, how about calls like (well, not a pretty one, but you get the
- >idea...):
-
- > fprintf(stderr, "%-*.2!", something);
-
- This would call
- bangcvt(&ap, buf, len, { '!', something, 2, FMT_LEFT });
- and leave the interpretation of the width and precision up to bangcvt.
- flags are or'ed together.
-
- It might not work correctly; I think my sample implementation may have a bug
- in handling flags. The principle is as given, though.
-
- -s
-